using System;
using System.Collections.Generic;
using System.Text;
using SCG.SolarVengeanceEngine;
using SCG.General;

namespace SCG.SolarVengeance.Scenarios
{
    public class DoubleCluster : Scenario
    {
        //Build the scenario
        public override void BuildScenario(int numPlayers, int capitalValues, int startingResources)
        {
            //create the two clusters
            CreateStarCluster(SVGame.Random(12, 20), 25, 50, 25, 50, 20, 4);
            CreateStarCluster(SVGame.Random(12, 20), 75, 50, 75, 50, 20, 4);

            //add some nebula
            int numNebula = SVGame.Random(1, 4);
            while (numNebula > 0)
            {
                CreateNebula(SVGame.Random(20, 80), SVGame.Random(20, 80), SVGame.Random(4, 8), SVGame.Random(30, 70));
                numNebula--;
            }

            //add wormholes on both sides
            int numWormholes = SVGame.Random(1, 4);
            while (numWormholes > 0)
            {
                CreateWormhole(SVGame.Random(10, 20), SVGame.Random(30, 70), SVGame.Random(30, 70), SVGame.Random(30, 70));
                numWormholes--;
            }
            numWormholes = SVGame.Random(1, 4);
            while (numWormholes > 0)            
            {
                CreateWormhole(SVGame.Random(60, 90), SVGame.Random(30, 70), SVGame.Random(30, 70), SVGame.Random(30, 70));
                numWormholes--;
            }

            //assign capitals to alternating clusters
            for (int i = 0; i < Game.Players.Count; i++)
            {
                if (i % 2 == 0)
                    AssignCapital(Game.Players[i], new SCGRect(0, 0, 50, 100));
                else
                    AssignCapital(Game.Players[i], new SCGRect(50, 0, 100, 100));
            }
        }

        //Scenario description
        public override string Description
        {
            get
            {
                return "Two Star Clusters dominate this Scenario, and alternating Star Lords will find their Capitals in different Clusters.";
            }
        }
    }
}
